<%- include('./common/header.html');%>
    <div class="container">
        <form class="form-inline" action="/addTodo" method="post">

            <div class="form-group">
                <input type="text" class="form-control" name="title" id="" placeholder="请输入待办事项">
                <button class="btn btn-success">添加</button>
            </div>
        </form>
        <table class="table table-striped">
            <% for(let i = 0; i < todoList.length; i++){ %>
            <% let todo = todoList[i]; %>
            <tr>
                <td><input type="checkbox" <%= todo.isDone ? 'checked' : '' %> name="" id=""></td>
                <td><%= todo.title %></td>
                <td><a href="/delete?_id=<%=todo._id%>" class="btn btn-danger">删除</a> | <a href="/delete/<%=todo._id%>" class="btn btn-danger">删除</a></td>
            </tr>
            <% }%>
            


        </table>
        <div>
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <% for(let i=1; i <= totalPage; i++){%>
                    <li class="<%= page === i ? 'active' : ''%>"><a href="/index?page=<%=i%>"><%=i%></a></li>
                    <% } %>
                    <li>
                        <a href="" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
    <%- include('./common/footer.html');%>